package cn.good.yan.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 公共返回对象
 *
 * @author shengren.yan
 * @create 2024/11/3
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Re {
    private long code;
    private String message;
    private Object obj;

    // 成功返回
    public static Re success(String message) {
        return new Re(200, message, null);
    }

    // 成功返回结果
    public static Re success(String message, Object obj) {
        return new Re(200, message, obj);
    }

    // 失败返回
    public static Re error(String message) {
        return new Re(500, message, null);
    }

    // 失败返回结果
    public static Re error(String message, Object obj) {
        return new Re(500, message, obj);
    }

}
